From: Po Lu Date: Tue, 15 Mar 2022 04:14:56 +0000 (+0800) Subject: Fix crashes when trying to pop up a menu on GTK 2 X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~16^2~2370^2~1119 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=90742d7b01366418f76d7bd08b19719901997903;p=emacs.git Fix crashes when trying to pop up a menu on GTK 2 * src/xterm.c (handle_one_xevent): Respect finish when dispatching copy. --- diff --git a/src/xterm.c b/src/xterm.c index e48592210fd..fc90e370430 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12533,15 +12533,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (popup_activated () && xev->evtype == XI_ButtonRelease) - { - *finish = X_EVENT_DROP; - gtk_main_do_event (copy); - gdk_event_free (copy); - goto XI_OTHER; - } - - gtk_main_do_event (copy); - gdk_event_free (copy); + goto XI_OTHER; #endif #ifdef HAVE_XINPUT2_1 @@ -13717,6 +13709,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, } unblock_input (); #endif /* USE_X_TOOLKIT */ +#if defined USE_GTK && !defined HAVE_GTK3 && defined HAVE_XINPUT2 + if (*finish != X_EVENT_DROP && copy) + { + gtk_main_do_event (copy); + *finish = X_EVENT_DROP; + } + + if (copy) + gdk_event_free (copy); +#endif break; }